Skip to main content
Version: 2.0

Before You Start

Enterprise needs to authenticate itself and receive an authentication token. It will enable it to access the service. Sinch India APIs currently support 2-factor authentication using token based authentication method.

Token based authentication
This method does not require client IPs to be whitelisted at the time of onboarding. In this method, business must use a bearer token, which can be generated using username and password, also known as Password Authentication Method.


Curl Request- (For Production)

curl --location --request POST ' \
https://auth.aclwhatsapp.com/realms/ipmessaging/protocol/openid-connect/token
\
--header 'cache-control: no-cache' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=ipmessaging-client' \
--data-urlencode 'username=abc' \
--data-urlencode 'password=abc'

Header Values

NameDescriptionValue
cache-controlFixed valueno-cache
content-typeFixed valueapplication/x-www-form urlencoded

Data Object Values

NameDescriptionValue
grant_typeFixed Valuepassword
client_idFixed Valueipmessaging-client
usernameValue provided by Sinch at the time of onboarding.user-name
passwordValue provided by Sinch at the time of onboarding.password

The response of the above request is as follows:

Payload

  {
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi",
"expires_in": 3600,
"refresh_expires_in": 1800,
"refresh_token": "eyJhbGciOiJIUzI1NiIsIn",
"token_type": "Bearer",
"not-before-policy": 0,
"session_state": "f2cd48bf-d162-4754-b2c7-bdc9c97064b3",
"scope": "email profile"
}

NameDescription
access_tokenAccess token value to be used for sending messages.
refresh_tokenToken that can be used to get a new access token.
expires_inTime span for which access token is valid in seconds.
refresh_expires_inThe amount of time, the refresh_token is valid.
token_typeIt has fixed value Bearer.

After getting the access token, Businesses can send the messages using the message sending API provided by Sinch.

The Header section will be:

Payload:

--header 'Authorization: Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6'
--header 'content-type: application/json'

NameDescription
AuthorizationBearer token - access_token value received from token API.
content-typeFixed value - application/json